﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.flashsale.ui {
    import flash.utils.*;
    import Display.DialogUI.*;
    import org.aswing.*;
    import Classes.*;
    import org.aswing.geom.*;
    import Display.*;
    import flash.text.*;
    import org.aswing.ext.*;
    import Display.aswingui.*;
    import Display.aswingui.gridlistui.*;

    public class FlashSaleDialogView extends GenericDialogView {

        protected var m_packageShelf:GridList;

        public function FlashSaleDialogView(_arg1:Dictionary, _arg2:String="", _arg3:String="", _arg4:int=0, _arg5:Function=null, _arg6:String="", _arg7:int=0, _arg8:Object=null){
            if (((_arg8.hasOwnProperty("listdata")) && (!(this.m_packageShelf)))){
                this.m_packageShelf = this.createPackageGridList(_arg8.listdata);
            };
            super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, "", _arg8.skipCallback, "");
        }
        protected function get HEADING_TOP_PAD():int{
            return (10);
        }
        protected function get HEADING_LEFT_PAD():int{
            return (20);
        }
        protected function get HEADING_WIDTH():int{
            return (420);
        }
        protected function get HEADINGA_FONTSIZE():int{
            return (28);
        }
        protected function get HEADINGB_FONTSIZE():int{
            return (26);
        }
        protected function get BODYB_TOP_PAD():int{
            return (0);
        }
        protected function get BODYB_BOTTOM_PAD():int{
            return (5);
        }
        protected function get BODYA_FONTSIZE():int{
            return (48);
        }
        protected function get BODYB_FONTSIZE():int{
            return (16);
        }
        protected function get CELL_CLASS():Class{
            return (PackageSaleCell);
        }
        private function get CELL_WIDTH():int{
            return (this.CELL_CLASS["CELL_WIDTH"]);
        }
        private function get CELL_HEIGHT():int{
            return (this.CELL_CLASS["CELL_HEIGHT"]);
        }
        override protected function makeBackground():void{
            var _local1:MarginBackground;
            if (m_bgAsset){
                _local1 = new MarginBackground(m_bgAsset, new Insets(0, 0, 10, 0));
                this.setBackgroundDecorator(_local1);
                this.setPreferredSize(new IntDimension(m_bgAsset.width, m_bgAsset.height));
                this.setMinimumSize(new IntDimension(m_bgAsset.width, m_bgAsset.height));
                this.setMaximumSize(new IntDimension(m_bgAsset.width, m_bgAsset.height));
            };
            ASwingHelper.prepare(this);
        }
        override protected function createInteriorHolder():JPanel{
            var _local1:JPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.TOP, -10);
            _local1.setPreferredSize(new IntDimension(this.width, this.height));
            _local1.appendAll(createHeaderPanel(), this.createTextArea());
            return (_local1);
        }
        override protected function createTextArea():JPanel{
            var _local1:JPanel = new JPanel(new BorderLayout());
            _local1.setPreferredSize(new IntDimension((this.width - 50), (this.height - 50)));
            _local1.append(this.createTopPanel(), BorderLayout.NORTH);
            _local1.append(this.createBottomPanel(), BorderLayout.SOUTH);
            return (_local1);
        }
        protected function createTopPanel():JPanel{
            var _local1:JPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.CENTER);
            var _local2:JPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.CENTER);
            _local2.setPreferredWidth(this.HEADING_WIDTH);
            _local2.setMaximumWidth(this.HEADING_WIDTH);
            ASwingHelper.setEasyBorder(_local2, this.HEADING_TOP_PAD, this.HEADING_LEFT_PAD, 0, 0);
            _local2.appendAll(this.createTopPanelHeader(), ASwingHelper.verticalStrut(5), this.createTopPanelBody());
            _local1.append(_local2);
            return (_local1);
        }
        protected function createTopPanelHeader():JPanel{
            var _local1:JPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.CENTER);
            var _local2:String = TextFieldUtil.formatSmallCapsString(assetDict["loc_heading1"]);
            var _local3:String = TextFieldUtil.formatSmallCapsString(assetDict["loc_heading2"]);
            var _local4:TextFormat = new TextFormat();
            _local4.align = TextFormatAlign.CENTER;
            var _local5:JTextField = ASwingHelper.makeTextField(_local2, EmbeddedArt.TITLE_FONT, this.HEADINGA_FONTSIZE, EmbeddedArt.yellowTextColor, 3, _local4);
            var _local6:JLabel = ASwingHelper.makeLabel(_local3, EmbeddedArt.TITLE_FONT, this.HEADINGB_FONTSIZE, EmbeddedArt.darkBlueTextColor, JLabel.CENTER);
            _local5.setPreferredWidth(this.HEADING_WIDTH);
            _local5.filters = EmbeddedArt.newtitleFilters;
            _local1.appendAll(_local5, ASwingHelper.verticalStrut(-10), _local6);
            return (_local1);
        }
        protected function createTopPanelBody():JPanel{
            var _local1:JPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.CENTER);
            var _local2:String = assetDict["loc_body1"];
            var _local3:String = TextFieldUtil.formatSmallCapsString(assetDict["loc_body2"]);
            var _local4:String = assetDict["loc_body3"];
            var _local5:TextFormat = new TextFormat();
            _local5.align = TextFormatAlign.CENTER;
            var _local6:JLabel = ASwingHelper.makeLabel(_local2, EmbeddedArt.DEFAULT_FONT_NAME_BOLD, this.BODYB_FONTSIZE, EmbeddedArt.darkBrownTextColor, JLabel.CENTER);
            var _local7:JTextField = ASwingHelper.makeTextField(_local3, EmbeddedArt.TITLE_FONT, this.BODYA_FONTSIZE, EmbeddedArt.yellowTextColor, 3, _local5);
            var _local8:JLabel = ASwingHelper.makeLabel(_local4, EmbeddedArt.DEFAULT_FONT_NAME_BOLD, this.BODYB_FONTSIZE, EmbeddedArt.darkBrownTextColor, JLabel.CENTER);
            _local7.setPreferredWidth(this.HEADING_WIDTH);
            _local7.filters = EmbeddedArt.newtitleFilters;
            ASwingHelper.setEasyBorder(_local7, this.BODYB_TOP_PAD, 0, this.BODYB_BOTTOM_PAD, 0);
            _local1.appendAll(_local6, _local7, _local8);
            return (_local1);
        }
        protected function createBottomPanel():JPanel{
            var _local1:JPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.CENTER);
            if (this.m_packageShelf){
                _local1.append(this.m_packageShelf);
                this.m_packageShelf.setPreferredHeight(this.CELL_HEIGHT);
                this.m_packageShelf.setTileWidth(this.CELL_WIDTH);
                this.m_packageShelf.setTileHeight(this.CELL_HEIGHT);
                this.m_packageShelf.setHGap(5);
            };
            return (_local1);
        }
        protected function createPackageGridList(_arg1:Array):GridList{
            var _local2:GridList;
            var _local3:VectorListModel = new VectorListModel(_arg1);
            _local2 = new GridList(_local3, new GenericGridCellFactory(this.CELL_CLASS), 3, 0);
            return (_local2);
        }

    }
}//package Modules.flashsale.ui 
